package com.yunhe.java.Day13;

import java.util.*;

/**
 * map 嵌套List
 */
public class MapQianTaoList {
    public static void main(String[] args) {
//        List<Java> list = new ArrayList<>();
//        List<UI>   list2= new ArrayList<>();
//        list.add(new Java("王大",19,"Java-04"));
//        list.add(new Java("王二",19,"Java-06"));
//        list.add(new Java("王末",19,"Java-02"));
//         list2.add(new UI("张大",18,"UI-01"));
//        list2.add(new UI("张三",18,"UI-03"));
//        list2.add(new UI("张五",18,"UI-05"));
        List<Student> list = new ArrayList<>();
        List<Student> list2= new ArrayList<>();
        list.add(new Student("赵新01"));
        list.add(new Student("赵新02"));
        list.add(new Student("赵新03"));
        list2.add(new Student("忙森01"));
        list2.add(new Student("忙森02"));
        list2.add(new Student("忙森03"));
        Map<String,List<Student>> map= new HashMap<>();
        map.put("Java",list);
        map.put("UI",list2);
        //遍历所有学员信息
        Set<String> keys= map.keySet();
        for(String key:keys){
            for(Student st:map.get(key)){
                System.out.print(st.getName()+" ");
            }
        }
        System.out.println();
        //遍历UI学员 信息
        Iterator<Student> iterator=map.get("Java").iterator();
        while(iterator.hasNext()){
            Student st= iterator.next();
            System.out.println(st.getName());
//            System.out.print(iterator.next().getName()+" ");
        }
    }
}